﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class test2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        /*
       // string path = Directory.GetCurrentDirectory();//E:\log
        string filePath = "E:\\log\\log2.txt";//这里是你的已知文件
        FileStream fs = File.Create(filePath);
       // FileStream fs = new FileStream(filePath, FileMode.Create, FileAccess.ReadWrite);
        StreamWriter sw = new StreamWriter(fs);
        fs.SetLength(0);//首先把文件清空了。
        sw.Write("22111-----dfsdfsfsf测试");//写你的字符串。
        sw.Close();
        */
       // test1();
    }
    public void test1()
    {
        string path = Server.MapPath("");
        string filePath = path+ "\\log\\log2.txt";//
        using (FileStream fs = File.Create(filePath))
        {
            StreamWriter sw = new StreamWriter(fs);
            fs.SetLength(0);//首先把文件清空了。
            sw.Write("22111-----dfsdfsfsf测试");//写你的字符串。
            sw.Close();
        }

    }
}